pkgname=kernel26-TPSO02
basekernel=2.6.39.2
pkgver=2.6.39.2
pkgrel=1
pkgdesc="The Linux Kernel and modules"
arch=('i686' 'x86_64')
license=('GPL')
url="http://www.kernel.org"
depends=('module-init-tools' 'mkinitcpio')
provides=(kernel26)
install=kernel26.install

build() {
  LOCAL_VERSION="$(grep "CONFIG_LOCALVERSION=" $startdir/.config | sed 's/.*"\(.*\)"/\1/')"

  cd ..

  # Modify the make line below to make -j[# of processors + 1] if you
  # have a multi-core system. This will enable you to compile the kernel faster.
  make -j3 || return 1

  mkdir -p $startdir/pkg/{lib/modules,boot}
  make INSTALL_MOD_PATH=$startdir/pkg modules_install || return 1

  # There's no separation of firmware depending on kernel version - 
  # comment this line if you intend on using the built kernel exclusively,
  # otherwise there'll be file conflicts with the existing kernel
  rm -rf $startdir/pkg/lib/firmware

  install -Dm644 "System.map" "$startdir/pkg/boot/System.map26$LOCAL_VERSION"
  install -Dm644 "arch/x86/boot/bzImage" "$startdir/pkg/boot/vmlinuz26$LOCAL_VERSION"

  # Change the version strings in kernel26.install
  sed -i \
	-e "s/KERNEL_VERSION=.*/KERNEL_VERSION=\"$basekernel\"/" \
	-e "s/LOCAL_VERSION=.*/LOCAL_VERSION=\"$LOCAL_VERSION\"/" \
	$startdir/kernel26.install
}
